package com.study.seata.storage.controller;

import com.study.seata.common.model.storage.Storage;
import com.study.seata.storage.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @author
 */
@Controller
@RequestMapping("/storage")
public class StorageController {
    @Autowired
    private StorageService storageService;

    /**
     *
     * @param storage
     * @param request
     */
    @ResponseBody
    @RequestMapping("/insert")
    public Object purchase(@RequestBody Storage storage,HttpServletRequest request) {
        Map<String, Object> result = storageService.insert(storage);
        return result;
    }
}